
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Isolate · Dart编程指南</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="arcticfox">
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="异常处理.html" />
    
    
    <link rel="prev" href="异步编程之Stream.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.bczl.xyz/" target="_blank" class="custom-link">主页</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="基础篇.html">
            
                <a href="基础篇.html">
            
                    
                    基础篇
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="环境搭建.html">
            
                <a href="环境搭建.html">
            
                    
                    环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="简单语法.html">
            
                <a href="简单语法.html">
            
                    
                    简单语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="函数.html">
            
                <a href="函数.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="进阶篇.html">
            
                <a href="进阶篇.html">
            
                    
                    进阶篇
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="面向对象.html">
            
                <a href="面向对象.html">
            
                    
                    面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="泛型.html">
            
                <a href="泛型.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="枚举.html">
            
                <a href="枚举.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="库与导入.html">
            
                <a href="库与导入.html">
            
                    
                    库与导入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="异步编程.html">
            
                <a href="异步编程.html">
            
                    
                    异步编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.5.1" data-path="异步编程之Future.html">
            
                <a href="异步编程之Future.html">
            
                    
                    Future
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.2" data-path="异步编程之Stream.html">
            
                <a href="异步编程之Stream.html">
            
                    
                    Stream
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.5.3" data-path="异步编程之Isolate.html">
            
                <a href="异步编程之Isolate.html">
            
                    
                    Isolate
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="异常处理.html">
            
                <a href="异常处理.html">
            
                    
                    异常处理与 Zone
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="生成器.html">
            
                <a href="生成器.html">
            
                    
                    生成器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="标准流与文件.html">
            
                <a href="标准流与文件.html">
            
                    
                    标准流与文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="运算符.html">
            
                <a href="运算符.html">
            
                    
                    附：运算符
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="常用标准库.html">
            
                <a href="常用标准库.html">
            
                    
                    常用标准库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="字符串.html">
            
                <a href="字符串.html">
            
                    
                    字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="集合.html">
            
                <a href="集合.html">
            
                    
                    集合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="URI处理.html">
            
                <a href="URI处理.html">
            
                    
                    URI处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="日期和时间.html">
            
                <a href="日期和时间.html">
            
                    
                    日期和时间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="环境及外部调用.html">
            
                <a href="环境及外部调用.html">
            
                    
                    环境及外部调用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="其他.html">
            
                <a href="其他.html">
            
                    
                    其他
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="实战篇.html">
            
                <a href="实战篇.html">
            
                    
                    实战篇
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="网络编程.html">
            
                <a href="网络编程.html">
            
                    
                    网络编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="爬虫实战.html">
            
                <a href="爬虫实战.html">
            
                    
                    爬虫实战
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="HTTP服务器.html">
            
                <a href="HTTP服务器.html">
            
                    
                    HTTP服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="WebSocket服务器.html">
            
                <a href="WebSocket服务器.html">
            
                    
                    WebSocket服务器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    附录
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="dart2.14.html">
            
                <a href="dart2.14.html">
            
                    
                    升级到Dart 2.14
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="http://www.bczl.xyz/" target="blank" class="gitbook-link">
            编程之路
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Isolate</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><li><span class="title-icon "></span><a href="#isolate"><b></b>Isolate</a></li><ul><li><span class="title-icon "></span><a href="#spawnuri"><b></b>spawnUri</a></li><li><span class="title-icon "></span><a href="#spawn"><b></b>spawn</a></li><li><span class="title-icon "></span><a href="#flutter-&#x4E2D;&#x521B;&#x5EFA;isolate"><b></b>Flutter &#x4E2D;&#x521B;&#x5EFA;Isolate</a></li><li><span class="title-icon "></span><a href="#&#x4F7F;&#x7528;&#x573A;&#x666F;"><b></b>&#x4F7F;&#x7528;&#x573A;&#x666F;</a></li></ul></ul></ul></div><a href="#" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><!-- ex_nolevel -->
<h2 id="isolate"><a name="isolate" class="anchor-navigation-ex-anchor" href="#isolate"><i class="fa fa-link" aria-hidden="true"></i></a>Isolate</h2>
<p>&#x524D;&#x9762;&#x5DF2;&#x7ECF;&#x8BF4;&#x8FC7;&#xFF0C;&#x5C06;&#x975E;&#x5E38;&#x8017;&#x65F6;&#x7684;&#x4EFB;&#x52A1;&#x6DFB;&#x52A0;&#x5230;&#x4E8B;&#x4EF6;&#x961F;&#x5217;&#x540E;&#xFF0C;&#x4ECD;&#x7136;&#x4F1A;&#x62D6;&#x6162;&#x6574;&#x4E2A;&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;&#x7684;&#x5904;&#x7406;&#xFF0C;&#x751A;&#x81F3;&#x662F;&#x963B;&#x585E;&#x3002;&#x53EF;&#x89C1;&#x57FA;&#x4E8E;&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;&#x7684;&#x5F02;&#x6B65;&#x6A21;&#x578B;&#x4ECD;&#x7136;&#x662F;&#x6709;&#x5F88;&#x5927;&#x7F3A;&#x70B9;&#x7684;&#xFF0C;&#x8FD9;&#x65F6;&#x5019;&#x6211;&#x4EEC;&#x5C31;&#x9700;&#x8981;<code>Isolate</code>&#xFF0C;&#x8FD9;&#x4E2A;&#x5355;&#x8BCD;&#x7684;&#x4E2D;&#x6587;&#x610F;&#x601D;&#x662F;&#x9694;&#x79BB;&#x3002;</p>
<p>&#x7B80;&#x5355;&#x8BF4;&#xFF0C;&#x53EF;&#x4EE5;&#x628A;&#x5B83;&#x7406;&#x89E3;&#x4E3A;Dart&#x4E2D;&#x7684;&#x7EBF;&#x7A0B;&#x3002;&#x4F46;&#x5B83;&#x53C8;&#x4E0D;&#x540C;&#x4E8E;&#x7EBF;&#x7A0B;&#xFF0C;&#x66F4;&#x6070;&#x5F53;&#x7684;&#x8BF4;&#x5E94;&#x8BE5;&#x662F;&#x5FAE;&#x7EBF;&#x7A0B;&#xFF0C;&#x6216;&#x8005;&#x8BF4;&#x662F;&#x534F;&#x7A0B;&#x3002;&#x5B83;&#x4E0E;&#x7EBF;&#x7A0B;&#x6700;&#x5927;&#x7684;&#x533A;&#x522B;&#x5C31;&#x662F;&#x4E0D;&#x80FD;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#xFF0C;&#x56E0;&#x6B64;&#x4E5F;&#x4E0D;&#x5B58;&#x5728;&#x9501;&#x7ADE;&#x4E89;&#x95EE;&#x9898;&#xFF0C;&#x4E24;&#x4E2A;<code>Isolate</code>&#x5B8C;&#x5168;&#x662F;&#x4E24;&#x6761;&#x72EC;&#x7ACB;&#x7684;&#x6267;&#x884C;&#x7EBF;&#xFF0C;&#x4E14;&#x6BCF;&#x4E2A;<code>Isolate</code>&#x90FD;&#x6709;&#x81EA;&#x5DF1;&#x7684;<strong>&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;</strong>&#xFF0C;&#x5B83;&#x4EEC;&#x4E4B;&#x95F4;&#x53EA;&#x80FD;&#x901A;&#x8FC7;&#x53D1;&#x9001;&#x6D88;&#x606F;&#x901A;&#x4FE1;&#xFF0C;&#x6240;&#x4EE5;&#x5B83;&#x7684;&#x8D44;&#x6E90;&#x5F00;&#x9500;&#x4F4E;&#x4E8E;&#x7EBF;&#x7A0B;&#x3002;</p>
<p>&#x4ECE;&#x4E3B;<code>Isolate</code>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684;<code>Isolate</code>&#x6709;&#x4E24;&#x79CD;&#x65B9;&#x6CD5;</p>
<h3 id="spawnuri"><a name="spawnuri" class="anchor-navigation-ex-anchor" href="#spawnuri"><i class="fa fa-link" aria-hidden="true"></i></a>spawnUri</h3>
<p><code>static Future&lt;Isolate&gt; spawnUri()</code></p>
<p><code>spawnUri</code>&#x65B9;&#x6CD5;&#x6709;&#x4E09;&#x4E2A;&#x5FC5;&#x987B;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x662F;Uri&#xFF0C;&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x65B0;<code>Isolate</code>&#x4EE3;&#x7801;&#x6587;&#x4EF6;&#x7684;&#x8DEF;&#x5F84;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x662F;&#x53C2;&#x6570;&#x5217;&#x8868;&#xFF0C;&#x7C7B;&#x578B;&#x662F;<code>List&lt;String&gt;</code>&#xFF0C;&#x7B2C;&#x4E09;&#x4E2A;&#x662F;&#x52A8;&#x6001;&#x6D88;&#x606F;&#x3002;&#x9700;&#x8981;&#x6CE8;&#x610F;&#xFF0C;&#x7528;&#x4E8E;&#x8FD0;&#x884C;&#x65B0;<code>Isolate</code>&#x7684;&#x4EE3;&#x7801;&#x6587;&#x4EF6;&#x4E2D;&#xFF0C;&#x5FC5;&#x987B;&#x5305;&#x542B;&#x4E00;&#x4E2A;main&#x51FD;&#x6570;&#xFF0C;&#x5B83;&#x662F;&#x65B0;<code>Isolate</code>&#x7684;&#x5165;&#x53E3;&#x65B9;&#x6CD5;&#xFF0C;&#x8BE5;main&#x51FD;&#x6570;&#x4E2D;&#x7684;args&#x53C2;&#x6570;&#x5217;&#x8868;&#xFF0C;&#x6B63;&#x5BF9;&#x5E94;<code>spawnUri</code>&#x4E2D;&#x7684;&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x3002;&#x5982;&#x4E0D;&#x9700;&#x8981;&#x5411;&#x65B0;<code>Isolate</code>&#x4E2D;&#x4F20;&#x53C2;&#x6570;&#xFF0C;&#x8BE5;&#x53C2;&#x6570;&#x53EF;&#x4F20;&#x7A7A;<code>List</code></p>
<p>&#x4E3B;<code>Isolate</code>&#x4E2D;&#x7684;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-dart"><span class="hljs-keyword">import</span> <span class="hljs-string">&apos;dart:isolate&apos;</span>; 


<span class="hljs-keyword">void</span> main() {
  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;main isolate start&quot;</span>);
  create_isolate();
  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;main isolate stop&quot;</span>);
}

<span class="hljs-comment">// &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684; isolate</span>
create_isolate() <span class="hljs-keyword">async</span>{
  ReceivePort rp = <span class="hljs-keyword">new</span> ReceivePort();
  SendPort port1 = rp.sendPort;

  Isolate newIsolate = <span class="hljs-keyword">await</span> Isolate.spawnUri(<span class="hljs-keyword">new</span> <span class="hljs-built_in">Uri</span>(path: <span class="hljs-string">&quot;./other_task.dart&quot;</span>), [<span class="hljs-string">&quot;hello, isolate&quot;</span>, <span class="hljs-string">&quot;this is args&quot;</span>], port1);

  SendPort port2;
  rp.listen((message){
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;main isolate message: $message&quot;</span>);
    <span class="hljs-keyword">if</span> (message[<span class="hljs-number">0</span>] == <span class="hljs-number">0</span>){
      port2 = message[<span class="hljs-number">1</span>];
    }<span class="hljs-keyword">else</span>{
      port2?.send([<span class="hljs-number">1</span>,<span class="hljs-string">&quot;&#x8FD9;&#x6761;&#x4FE1;&#x606F;&#x662F; main isolate &#x53D1;&#x9001;&#x7684;&quot;</span>]);
    }
  });

  <span class="hljs-comment">// &#x53EF;&#x4EE5;&#x5728;&#x9002;&#x5F53;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8C03;&#x7528;&#x4EE5;&#x4E0B;&#x65B9;&#x6CD5;&#x6740;&#x6B7B;&#x521B;&#x5EFA;&#x7684; isolate</span>
  <span class="hljs-comment">// newIsolate.kill(priority: Isolate.immediate);</span>
}
</code></pre>
<p>&#x521B;&#x5EFA;<code>other_task.dart</code>&#x6587;&#x4EF6;&#xFF0C;&#x7F16;&#x5199;&#x65B0;<code>Isolate</code>&#x7684;&#x4EE3;&#x7801;</p>
<pre><code class="lang-dart"><span class="hljs-keyword">import</span> <span class="hljs-string">&apos;dart:isolate&apos;</span>;
<span class="hljs-keyword">import</span>  <span class="hljs-string">&apos;dart:io&apos;</span>;


<span class="hljs-keyword">void</span> main(args, SendPort port1) {
  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;isolate_1 start&quot;</span>);
  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;isolate_1 args: $args&quot;</span>);

  ReceivePort receivePort = <span class="hljs-keyword">new</span> ReceivePort();
  SendPort port2 = receivePort.sendPort;

  receivePort.listen((message){
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;isolate_1 message: $message&quot;</span>);
  });

  <span class="hljs-comment">// &#x5C06;&#x5F53;&#x524D; isolate &#x4E2D;&#x521B;&#x5EFA;&#x7684;SendPort&#x53D1;&#x9001;&#x5230;&#x4E3B; isolate&#x4E2D;&#x7528;&#x4E8E;&#x901A;&#x4FE1;</span>
  port1.send([<span class="hljs-number">0</span>, port2]);
  <span class="hljs-comment">// &#x6A21;&#x62DF;&#x8017;&#x65F6;5&#x79D2;</span>
  sleep(<span class="hljs-built_in">Duration</span>(seconds:<span class="hljs-number">5</span>));
  port1.send([<span class="hljs-number">1</span>, <span class="hljs-string">&quot;isolate_1 &#x4EFB;&#x52A1;&#x5B8C;&#x6210;&quot;</span>]);

  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;isolate_1 stop&quot;</span>);
}
</code></pre>
<p>&#x8FD0;&#x884C;&#x4E3B;<code>Isolate</code>&#x7684;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-dart">main isolate start
main isolate stop
isolate_1 start
isolate_1 args: [hello, isolate, <span class="hljs-keyword">this</span> <span class="hljs-keyword">is</span> args]
main isolate message: [<span class="hljs-number">0</span>, SendPort]
isolate_1 stop
main isolate message: [<span class="hljs-number">1</span>, isolate_1 &#x4EFB;&#x52A1;&#x5B8C;&#x6210;]
isolate_1 message: [<span class="hljs-number">1</span>, &#x8FD9;&#x6761;&#x4FE1;&#x606F;&#x662F; main isolate &#x53D1;&#x9001;&#x7684;]
</code></pre>
<p><img src="https://img-blog.csdnimg.cn/20190505111443334.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9hcmN0aWNmb3guYmxvZy5jc2RuLm5ldA==,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
&#x6574;&#x4E2A;&#x6D88;&#x606F;&#x901A;&#x4FE1;&#x8FC7;&#x7A0B;&#x5982;&#x4E0A;&#x56FE;&#x6240;&#x793A;&#xFF0C;<strong>&#x4E24;&#x4E2A;Isolate&#x662F;&#x901A;&#x8FC7;&#x4E24;&#x5BF9;Port&#x5BF9;&#x8C61;&#x901A;&#x4FE1;&#xFF0C;&#x4E00;&#x5BF9;Port&#x5206;&#x522B;&#x7531;&#x7528;&#x4E8E;&#x63A5;&#x6536;&#x6D88;&#x606F;&#x7684;<code>ReceivePort</code>&#x5BF9;&#x8C61;&#xFF0C;&#x548C;&#x7528;&#x4E8E;&#x53D1;&#x9001;&#x6D88;&#x606F;&#x7684;<code>SendPort</code>&#x5BF9;&#x8C61;&#x6784;&#x6210;&#x3002;&#x5176;&#x4E2D;<code>SendPort</code>&#x5BF9;&#x8C61;&#x4E0D;&#x7528;&#x5355;&#x72EC;&#x521B;&#x5EFA;&#xFF0C;&#x5B83;&#x5DF2;&#x7ECF;&#x5305;&#x542B;&#x5728;<code>ReceivePort</code>&#x5BF9;&#x8C61;&#x4E4B;&#x4E2D;&#x3002;&#x9700;&#x8981;&#x6CE8;&#x610F;&#xFF0C;&#x4E00;&#x5BF9;Port&#x5BF9;&#x8C61;&#x53EA;&#x80FD;&#x5355;&#x5411;&#x53D1;&#x6D88;&#x606F;&#xFF0C;&#x8FD9;&#x5C31;&#x5982;&#x540C;&#x4E00;&#x6839;&#x81EA;&#x6765;&#x6C34;&#x7BA1;&#xFF0C;<code>ReceivePort</code>&#x548C;<code>SendPort</code>&#x5206;&#x522B;&#x4F4D;&#x4E8E;&#x6C34;&#x7BA1;&#x7684;&#x4E24;&#x5934;&#xFF0C;&#x6C34;&#x6D41;&#x53EA;&#x80FD;&#x4ECE;<code>SendPort</code>&#x8FD9;&#x5934;&#x6D41;&#x5411;<code>ReceivePort</code>&#x8FD9;&#x5934;&#x3002;&#x56E0;&#x6B64;&#xFF0C;&#x4E24;&#x4E2A;<code>Isolate</code>&#x4E4B;&#x95F4;&#x7684;&#x6D88;&#x606F;&#x901A;&#x4FE1;&#x80AF;&#x5B9A;&#x662F;&#x9700;&#x8981;&#x4E24;&#x6839;&#x8FD9;&#x6837;&#x7684;&#x6C34;&#x7BA1;&#x7684;&#xFF0C;&#x8FD9;&#x5C31;&#x9700;&#x8981;&#x4E24;&#x5BF9;Port&#x5BF9;&#x8C61;&#x3002;</strong></p>
<p>&#x7406;&#x89E3;&#x4E86;<code>Isolate</code>&#x6D88;&#x606F;&#x901A;&#x4FE1;&#x7684;&#x539F;&#x7406;&#xFF0C;&#x90A3;&#x4E48;&#x5728;Dart&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x5177;&#x4F53;&#x662F;&#x5982;&#x4F55;&#x64CD;&#x4F5C;&#x7684;&#x5462;&#xFF1F;
<img src="https://img-blog.csdnimg.cn/20190505121830821.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9hcmN0aWNmb3guYmxvZy5jc2RuLm5ldA==,size_16,color_FFFFFF,t_70" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
<strong><code>ReceivePort</code>&#x5BF9;&#x8C61;&#x901A;&#x8FC7;&#x8C03;&#x7528;<code>listen</code>&#x65B9;&#x6CD5;&#xFF0C;&#x4F20;&#x5165;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x53EF;&#x7528;&#x6765;&#x76D1;&#x542C;&#x5E76;&#x5904;&#x7406;&#x53D1;&#x9001;&#x6765;&#x7684;&#x6D88;&#x606F;&#x3002;<code>SendPort</code>&#x5BF9;&#x8C61;&#x5219;&#x8C03;&#x7528;<code>send()</code>&#x65B9;&#x6CD5;&#x6765;&#x53D1;&#x9001;&#x6D88;&#x606F;&#x3002;<code>send</code>&#x65B9;&#x6CD5;&#x4F20;&#x5165;&#x7684;&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;<code>null</code>,<code>num</code>, <code>bool</code>, <code>double</code>,<code>String</code>, <code>List</code> ,<code>Map</code>&#x6216;&#x8005;&#x662F;&#x81EA;&#x5B9A;&#x4E49;&#x7684;&#x7C7B;&#x3002;</strong> &#x5728;&#x4E0A;&#x4F8B;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x53D1;&#x9001;&#x7684;&#x662F;&#x5305;&#x542B;&#x4E24;&#x4E2A;&#x5143;&#x7D20;&#x7684;<code>List</code>&#x5BF9;&#x8C61;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x662F;&#x6574;&#x578B;&#xFF0C;&#x8868;&#x793A;&#x6D88;&#x606F;&#x7C7B;&#x578B;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x5143;&#x7D20;&#x5219;&#x8868;&#x793A;&#x6D88;&#x606F;&#x5185;&#x5BB9;&#x3002;</p>
<h3 id="spawn"><a name="spawn" class="anchor-navigation-ex-anchor" href="#spawn"><i class="fa fa-link" aria-hidden="true"></i></a>spawn</h3>
<p><code>static Future&lt;Isolate&gt; spawn()</code></p>
<p>&#x9664;&#x4E86;&#x4F7F;&#x7528;<code>spawnUri</code>&#xFF0C;&#x66F4;&#x5E38;&#x7528;&#x7684;&#x662F;&#x4F7F;&#x7528;<code>spawn</code>&#x65B9;&#x6CD5;&#x6765;&#x521B;&#x5EFA;&#x65B0;&#x7684;<code>Isolate</code>&#xFF0C;&#x6211;&#x4EEC;&#x901A;&#x5E38;&#x5E0C;&#x671B;&#x5C06;&#x65B0;&#x521B;&#x5EFA;&#x7684;<code>Isolate</code>&#x4EE3;&#x7801;&#x548C;<code>main Isolate</code>&#x4EE3;&#x7801;&#x5199;&#x5728;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#xFF0C;&#x4E14;&#x4E0D;&#x5E0C;&#x671B;&#x51FA;&#x73B0;&#x4E24;&#x4E2A;main&#x51FD;&#x6570;&#xFF0C;&#x800C;&#x662F;&#x5C06;&#x6307;&#x5B9A;&#x7684;&#x8017;&#x65F6;&#x51FD;&#x6570;&#x8FD0;&#x884C;&#x5728;&#x65B0;&#x7684;<code>Isolate</code>&#xFF0C;&#x8FD9;&#x6837;&#x505A;&#x6709;&#x5229;&#x4E8E;&#x4EE3;&#x7801;&#x7684;&#x7EC4;&#x7EC7;&#x548C;&#x4EE3;&#x7801;&#x7684;&#x590D;&#x7528;&#x3002;<code>spawn</code>&#x65B9;&#x6CD5;&#x6709;&#x4E24;&#x4E2A;&#x5FC5;&#x987B;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x662F;&#x9700;&#x8981;&#x8FD0;&#x884C;&#x5728;&#x65B0;<code>Isolate</code>&#x7684;&#x8017;&#x65F6;&#x51FD;&#x6570;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x662F;&#x52A8;&#x6001;&#x6D88;&#x606F;&#xFF0C;&#x8BE5;&#x53C2;&#x6570;&#x901A;&#x5E38;&#x7528;&#x4E8E;&#x4F20;&#x9001;&#x4E3B;<code>Isolate</code>&#x7684;<code>SendPort</code>&#x5BF9;&#x8C61;&#x3002;</p>
<p><code>spawn</code>&#x7684;&#x7528;&#x6CD5;&#x4E0E;<code>spawnUri</code>&#x76F8;&#x4F3C;&#xFF0C;&#x4E14;&#x66F4;&#x4E3A;&#x7B80;&#x6D01;&#xFF0C;&#x5C06;&#x4E0A;&#x9762;&#x4F8B;&#x5B50;&#x7A0D;&#x4F5C;&#x4FEE;&#x6539;&#x5982;&#x4E0B;</p>
<pre><code class="lang-dart"><span class="hljs-keyword">import</span> <span class="hljs-string">&apos;dart:isolate&apos;</span>; 
<span class="hljs-keyword">import</span>  <span class="hljs-string">&apos;dart:io&apos;</span>;

<span class="hljs-keyword">void</span> main() {
  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;main isolate start&quot;</span>);
  create_isolate();
  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;main isolate end&quot;</span>);
}

<span class="hljs-comment">// &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684; isolate</span>
create_isolate() <span class="hljs-keyword">async</span>{
  ReceivePort rp = <span class="hljs-keyword">new</span> ReceivePort();
  SendPort port1 = rp.sendPort;

  Isolate newIsolate = <span class="hljs-keyword">await</span> Isolate.spawn(doWork, port1);

  SendPort port2;
  rp.listen((message){
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;main isolate message: $message&quot;</span>);
    <span class="hljs-keyword">if</span> (message[<span class="hljs-number">0</span>] == <span class="hljs-number">0</span>){
      port2 = message[<span class="hljs-number">1</span>];
    }<span class="hljs-keyword">else</span>{
      port2?.send([<span class="hljs-number">1</span>,<span class="hljs-string">&quot;&#x8FD9;&#x6761;&#x4FE1;&#x606F;&#x662F; main isolate &#x53D1;&#x9001;&#x7684;&quot;</span>]);
    }
  });
}

<span class="hljs-comment">// &#x5904;&#x7406;&#x8017;&#x65F6;&#x4EFB;&#x52A1;</span>
<span class="hljs-keyword">void</span> doWork(SendPort port1){
  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;new isolate start&quot;</span>);
  ReceivePort rp2 = <span class="hljs-keyword">new</span> ReceivePort();
  SendPort port2 = rp2.sendPort;

  rp2.listen((message){
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;doWork message: $message&quot;</span>);
  });

  <span class="hljs-comment">// &#x5C06;&#x65B0;isolate&#x4E2D;&#x521B;&#x5EFA;&#x7684;SendPort&#x53D1;&#x9001;&#x5230;&#x4E3B;isolate&#x4E2D;&#x7528;&#x4E8E;&#x901A;&#x4FE1;</span>
  port1.send([<span class="hljs-number">0</span>, port2]);
  <span class="hljs-comment">// &#x6A21;&#x62DF;&#x8017;&#x65F6;5&#x79D2;</span>
  sleep(<span class="hljs-built_in">Duration</span>(seconds:<span class="hljs-number">5</span>));
  port1.send([<span class="hljs-number">1</span>, <span class="hljs-string">&quot;doWork &#x4EFB;&#x52A1;&#x5B8C;&#x6210;&quot;</span>]);

  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;new isolate end&quot;</span>);
}
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code>main isolate start
main isolate end
new isolate start
main isolate message: [0, SendPort]
new isolate end
main isolate message: [1, doWork &#x4EFB;&#x52A1;&#x5B8C;&#x6210;]
doWork message: [1, &#x8FD9;&#x6761;&#x4FE1;&#x606F;&#x662F; main isolate &#x53D1;&#x9001;&#x7684;]
</code></pre><p>&#x65E0;&#x8BBA;&#x662F;&#x4E0A;&#x9762;&#x7684;<code>spawn</code>&#x8FD8;&#x662F;<code>spawnUri</code>&#xFF0C;&#x8FD0;&#x884C;&#x540E;&#x90FD;&#x4F1A;&#x5305;&#x542B;&#x4E24;&#x4E2A;Isolate&#xFF0C;&#x4E00;&#x4E2A;&#x662F;&#x4E3B;<code>Isolate</code>&#xFF0C;&#x4E00;&#x4E2A;&#x662F;&#x65B0;<code>Isolate</code>&#xFF0C;&#x4E24;&#x4E2A;&#x90FD;&#x53CC;&#x5411;&#x7ED1;&#x5B9A;&#x4E86;&#x6D88;&#x606F;&#x901A;&#x4FE1;&#x7684;&#x901A;&#x9053;&#xFF0C;&#x5373;&#x4F7F;&#x65B0;&#x7684;<code>Isolate</code>&#x4E2D;&#x7684;&#x4EFB;&#x52A1;&#x5B8C;&#x6210;&#x4E86;&#xFF0C;&#x5B83;&#x4E5F;&#x4E0D;&#x4F1A;&#x7ACB;&#x523B;&#x9000;&#x51FA;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x5F53;&#x4F7F;&#x7528;&#x5B8C;&#x81EA;&#x5DF1;&#x521B;&#x5EFA;&#x7684;<code>Isolate</code>&#x540E;&#xFF0C;&#x6700;&#x597D;&#x8C03;&#x7528;<code>newIsolate.kill(priority: Isolate.immediate);</code>&#x5C06;<code>Isolate</code>&#x7ACB;&#x5373;&#x6740;&#x6B7B;&#x3002;</p>
<h3 id="flutter-&#x4E2D;&#x521B;&#x5EFA;isolate"><a name="flutter-&#x4E2D;&#x521B;&#x5EFA;isolate" class="anchor-navigation-ex-anchor" href="#flutter-&#x4E2D;&#x521B;&#x5EFA;isolate"><i class="fa fa-link" aria-hidden="true"></i></a>Flutter &#x4E2D;&#x521B;&#x5EFA;Isolate</h3>
<p>&#x65E0;&#x8BBA;&#x5982;&#x4F55;&#xFF0C;&#x5728;Dart&#x4E2D;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;<code>Isolate</code>&#x90FD;&#x663E;&#x5F97;&#x6709;&#x4E9B;&#x7E41;&#x7410;&#xFF0C;&#x53EF;&#x60DC;&#x7684;&#x662F;Dart&#x5B98;&#x65B9;&#x5E76;&#x672A;&#x63D0;&#x4F9B;&#x66F4;&#x9AD8;&#x7EA7;&#x5C01;&#x88C5;&#x3002;&#x4F46;&#x662F;&#xFF0C;&#x5982;&#x679C;&#x60F3;&#x5728;Flutter&#x4E2D;&#x521B;&#x5EFA;<code>Isolate</code>&#xFF0C;&#x5219;&#x6709;&#x66F4;&#x7B80;&#x4FBF;&#x7684;API&#xFF0C;&#x8FD9;&#x662F;&#x7531;<code>Flutter</code>&#x5B98;&#x65B9;&#x8FDB;&#x4E00;&#x6B65;&#x5C01;&#x88C5;<code>ReceivePort</code>&#x800C;&#x63D0;&#x4F9B;&#x7684;&#x66F4;&#x7B80;&#x6D01;API&#x3002;<a href="https://docs.flutter.io/flutter/foundation/compute.html" target="_blank">&#x8BE6;&#x7EC6;API&#x6587;&#x6863;</a></p>
<p>&#x4F7F;&#x7528;<code>compute</code>&#x51FD;&#x6570;&#x6765;&#x521B;&#x5EFA;&#x65B0;&#x7684;<code>Isolate</code>&#x5E76;&#x6267;&#x884C;&#x8017;&#x65F6;&#x4EFB;&#x52A1;</p>
<pre><code class="lang-dart"><span class="hljs-keyword">import</span> <span class="hljs-string">&apos;package:flutter/foundation.dart&apos;</span>;
<span class="hljs-keyword">import</span>  <span class="hljs-string">&apos;dart:io&apos;</span>;

<span class="hljs-comment">// &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684;Isolate&#xFF0C;&#x5728;&#x5176;&#x4E2D;&#x8FD0;&#x884C;&#x4EFB;&#x52A1;doWork</span>
create_new_task() <span class="hljs-keyword">async</span>{
  <span class="hljs-keyword">var</span> str = <span class="hljs-string">&quot;New Task&quot;</span>;
  <span class="hljs-keyword">var</span> result = <span class="hljs-keyword">await</span> compute(doWork, str);
  <span class="hljs-built_in">print</span>(result);
}


<span class="hljs-built_in">String</span> doWork(<span class="hljs-built_in">String</span> value){
  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;new isolate doWork start&quot;</span>);
  <span class="hljs-comment">// &#x6A21;&#x62DF;&#x8017;&#x65F6;5&#x79D2;</span>
  sleep(<span class="hljs-built_in">Duration</span>(seconds:<span class="hljs-number">5</span>));

  <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;new isolate doWork end&quot;</span>);
  <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;complete:$value&quot;</span>;
}
</code></pre>
<p><code>compute</code>&#x51FD;&#x6570;&#x6709;&#x4E24;&#x4E2A;&#x5FC5;&#x987B;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x662F;&#x5F85;&#x6267;&#x884C;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#x5FC5;&#x987B;&#x662F;&#x4E00;&#x4E2A;&#x9876;&#x7EA7;&#x51FD;&#x6570;&#xFF0C;&#x4E0D;&#x80FD;&#x662F;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#xFF0C;&#x53EF;&#x4EE5;&#x662F;&#x7C7B;&#x7684;&#x9759;&#x6001;&#x65B9;&#x6CD5;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x4E3A;&#x52A8;&#x6001;&#x7684;&#x6D88;&#x606F;&#x7C7B;&#x578B;&#xFF0C;&#x53EF;&#x4EE5;&#x662F;&#x88AB;&#x8FD0;&#x884C;&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#x3002;&#x9700;&#x8981;&#x6CE8;&#x610F;&#xFF0C;&#x4F7F;&#x7528;<code>compute</code>&#x5E94;&#x5BFC;&#x5165;<code>&apos;package:flutter/foundation.dart&apos;</code>&#x5305;&#x3002;</p>
<h3 id="&#x4F7F;&#x7528;&#x573A;&#x666F;"><a name="&#x4F7F;&#x7528;&#x573A;&#x666F;" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;&#x573A;&#x666F;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F7F;&#x7528;&#x573A;&#x666F;</h3>
<p><code>Isolate</code>&#x867D;&#x597D;&#xFF0C;&#x4F46;&#x4E5F;&#x6709;&#x5408;&#x9002;&#x7684;&#x4F7F;&#x7528;&#x573A;&#x666F;&#xFF0C;&#x4E0D;&#x5EFA;&#x8BAE;&#x6EE5;&#x7528;<code>Isolate</code>&#xFF0C;&#x5E94;&#x5C3D;&#x53EF;&#x80FD;&#x591A;&#x7684;&#x4F7F;&#x7528;Dart&#x4E2D;&#x7684;&#x4E8B;&#x4EF6;&#x5FAA;&#x73AF;&#x673A;&#x5236;&#x53BB;&#x5904;&#x7406;&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#xFF0C;&#x8FD9;&#x6837;&#x624D;&#x80FD;&#x66F4;&#x597D;&#x7684;&#x53D1;&#x6325;Dart&#x8BED;&#x8A00;&#x7684;&#x4F18;&#x52BF;&#x3002;</p>
<p>&#x90A3;&#x4E48;&#x5E94;&#x8BE5;&#x5728;&#x4EC0;&#x4E48;&#x65F6;&#x5019;&#x4F7F;&#x7528;<strong>Future</strong>&#xFF0C;&#x4EC0;&#x4E48;&#x65F6;&#x5019;&#x4F7F;&#x7528;<strong>Isolate</strong>&#x5462;&#xFF1F;
&#x4E00;&#x4E2A;&#x6700;&#x7B80;&#x5355;&#x7684;&#x5224;&#x65AD;&#x65B9;&#x6CD5;&#x662F;&#x6839;&#x636E;&#x67D0;&#x4E9B;&#x4EFB;&#x52A1;&#x7684;&#x5E73;&#x5747;&#x65F6;&#x95F4;&#x6765;&#x9009;&#x62E9;&#xFF1A;</p>
<ul>
<li>&#x65B9;&#x6CD5;&#x6267;&#x884C;&#x5728;&#x51E0;&#x6BEB;&#x79D2;&#x6216;&#x5341;&#x51E0;&#x6BEB;&#x79D2;&#x5DE6;&#x53F3;&#x7684;&#xFF0C;&#x5E94;&#x4F7F;&#x7528;<code>Future</code></li>
<li>&#x5982;&#x679C;&#x4E00;&#x4E2A;&#x4EFB;&#x52A1;&#x9700;&#x8981;&#x51E0;&#x767E;&#x6BEB;&#x79D2;&#x6216;&#x4E4B;&#x4E0A;&#x7684;&#xFF0C;&#x5219;&#x5EFA;&#x8BAE;&#x521B;&#x5EFA;&#x5355;&#x72EC;&#x7684;<code>Isolate</code></li>
</ul>
<p>&#x9664;&#x6B64;&#x4E4B;&#x5916;&#xFF0C;&#x8FD8;&#x6709;&#x4E00;&#x4E9B;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x7684;&#x573A;&#x666F;</p>
<ul>
<li>JSON &#x89E3;&#x7801;</li>
<li>&#x52A0;&#x5BC6;</li>
<li>&#x56FE;&#x50CF;&#x5904;&#x7406;&#xFF1A;&#x6BD4;&#x5982;&#x526A;&#x88C1;</li>
<li>&#x7F51;&#x7EDC;&#x8BF7;&#x6C42;&#xFF1A;&#x52A0;&#x8F7D;&#x8D44;&#x6E90;&#x3001;&#x56FE;&#x7247;</li>
</ul>
<p>&#x53C2;&#x8003;&#x8D44;&#x6599;&#xFF1A;</p>
<p><a href="https://api.dartlang.org/stable/2.3.0/dart-isolate/Isolate-class.html" target="_blank">Isolate &#x6587;&#x6863;</a></p>
<hr>
<p><strong>&#x516C;&#x4F17;&#x53F7;&#x201C;&#x7F16;&#x7A0B;&#x4E4B;&#x8DEF;&#x4ECE;0&#x5230;1&#x201D;</strong></p>
<p><img src="https://gitee.com/arcticfox1919/ImageHosting/raw/master/img/20190301102949549.jpg" alt="20190301102949549"> </p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; Arcticfox 2020 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x6587;&#x6863;&#x4FEE;&#x8BA2;&#x4E8E;&#xFF1A;
2021-03-18 13:34:35
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="异步编程之Stream.html" class="navigation navigation-prev " aria-label="Previous page: Stream">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="异常处理.html" class="navigation navigation-next " aria-label="Next page: 异常处理与 Zone">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Isolate","level":"1.3.5.3","depth":3,"next":{"title":"异常处理与 Zone","level":"1.3.6","depth":2,"path":"异常处理.md","ref":"异常处理.md","articles":[]},"previous":{"title":"Stream","level":"1.3.5.2","depth":3,"path":"异步编程之Stream.md","ref":"异步编程之Stream.md","articles":[]},"dir":"ltr"},"config":{"plugins":["anchor-navigation-ex","expandable-chapters-small","-lunr","-search","search-pro","-sharing","github","expandable-chapters","pageview-count","theme-comscore","tbfed-pagefooter","popup","custom-favicon"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy Arcticfox 2020","modify_label":"文档修订于：","modify_format":"YYYY-MM-DD HH:mm:ss"},"github":{"url":"https://github.com/arcticfox1919"},"search-pro":{},"popup":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"favicon":"logo.ico","theme-comscore":{},"pageview-count":{},"custom-favicon":{},"expandable-chapters-small":{},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"arcticfox","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Dart编程指南","language":"zh-hans","links":{"sidebar":{"主页":"http://www.bczl.xyz/"}},"gitbook":"*"},"file":{"path":"异步编程之Isolate.md","mtime":"2021-03-18T05:34:35.256Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-10-18T14:58:03.414Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

